package servletDemo;

import simple.form.cache.CacheManager;
import simple.form.core.ParameterBeanManager;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * Created by Administrator on 2017/2/20.
 */
@WebListener
public class SysInit implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        //1,获取配置文件信息
        SysContext.cleanHour = 3;
        SysContext.defaultTimeOut = 1000*30;

        SysContext.cacheManager = CacheManager.getInstance().setCleanHour(SysContext.cleanHour).setTimeOut(SysContext.defaultTimeOut);
        //2,扫描的bean包位置
        SysContext.beanPackageName ="test";
        SysContext.parameterBeanManager = ParameterBeanManager.getInstance().init(SysContext.beanPackageName);

    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
